﻿$.fn.datagrid.defaults.pageList = [10, 20, 30, 40, 50];
$.fn.datagrid.defaults.pageList = [100, 200, 300, 400, 500];

if ($.fn.numberspinner) {
    $.fn.numberspinner.defaults.missingMessage = '该输入项为必输项';
}

$.extend($.fn.validatebox.defaults.rules, {
    ip: {
        validator: function (value) {
            return /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/.test(value);
        },
        message: 'IP地址格式不正确！'
    },
    mac: {
        validator: function (value) {
            var result = false;
            var i = 0;
            if ((value) && (value.length == 12)) {
                result = true;

                for (i = 0; i < value.length; i++) {
                    if (!(((value[i] >= '0') && (value[i] <= '9')) || ((value[i] >= 'a') && (value[i] <= 'f')) || ((value[i] >= 'A') && (value[i] <= 'F')))) {
                        result = false;
                        break;
                    }
                }
            }
            return result;
        },
        message: '物理地址格式不正确！'
    },
    mobile: {
        validator: function (value) {
            var result = false;
            var i = 0;
            if ((value) && (value.length == 11)) {
                result = true;

                for (i = 0; i < value.length; i++) {
                    if ((value[i] < '0') && (value[i] > '9')) {
                        result = false;
                        break;
                    }
                }
            }
            return result;
        },
        message: '手机号码不正确！'
    }
});